<!DOCTYPE html>
<html>
  <head>
    <title>WebSocket Client</title>
  </head>
  <body>
    <h1>Tcp Client</h1>
    <!-- <div><button onclick="javascript:up()">UP</button></div>
    <div></div><button onclick="javascript:left()">LEFT</button>
    <button onclick="javascript:right()">RIGHT</button></div>
    <div><button onclick="javascript:down()">DOWN</button></div>
    <div id="output"></div> -->
<script>
    let net = require('net');

    let client = net.Socket();
    const host = '127.0.0.1';
    client.connect(10033, host, () => {
        console.log('connect the server');
        client.write('send first data');
    });

    client.on('data', data => {
        console.log('client data:', data);
    })

    client.on('end', () => {
        console.log('client end');
    })

    client.on('error', (err) => {
	    console.log(`client error: ${err}`);
    });
</script>
</body>
</html>